using System;
using System.Collections.Generic;
using System.Text;

using System.IO;
using System.Runtime.Serialization.Formatters.Binary;

namespace JieBooLaw.Domain
{
    interface IDomainObject
    {

    }
    
    public abstract class DomainObject : IDomainObject, IValidableObject, ICloneable
    {
        public virtual bool IsValid
        {
            get
            {
                try
                {
                    return true;
                }
                catch
                {
                    return false;
                }
            }
        }
        
        #region Declarations

        #endregion

        #region Methods
  
        #endregion

        #region Properties


        #endregion

        #region ICloneable Members

        public object Clone()
        {
            MemoryStream stream = new MemoryStream();

            BinaryFormatter formatter = new BinaryFormatter();

            formatter.Serialize(stream, this);

            stream.Position = 0;

            object obj = formatter.Deserialize(stream);

            return obj;
        }

        #endregion
    }
}
